#include "game.h"

const int N=5e5+5;
bool tru[N],fls[N];//一定是/不是

std :: vector<int> guess(int n, int limit) {
	std :: vector<int> ans;
	ans.resize(n);
	for(int i=1;i<=n;i++) ans[i-1]=i;
	for(int i=0;i<n;i++) tru[i]=fls[i]=0;
	if(n<=9&&limit==1e6){
		do{
			if(count(ans)==n) break;
		}while(next_permutation(ans.begin(),ans.end()));
		return ans;
	}
	int nows=count(ans);
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			if(tru[i]) break;
			if(fls[i]&&tru[j]) continue;
			std :: vector<int> p=ans;
			std :: swap(p[i],p[j]);
			int ct=count(p)-nows;
			if(ct==2){
				ans=p,nows+=2;
				tru[i]=tru[j]=1;
				fls[i]=fls[j]=0;
			}
			else if(ct==-2){
				tru[i]=tru[j]=1;
				fls[i]=fls[j]=0;
			}
			else if(ct==1){
				ans=p,nows++;
				tru[i]=tru[j]=0;
				fls[i]=fls[j]=0;
				bool flg=0;
				if(i>0){
					std :: vector<int> q=ans;
					std :: swap(q[i-1],q[i]);
					if(count(q)-nows==-2){
						tru[i]=1,fls[i]=0;
						tru[j]=0,fls[j]=1;
						flg=0;
					}
					else{
						tru[j]=1,fls[j]=0;
						tru[i]=0,fls[i]=1;
						flg=1;
					}
				}
				else{
					bool jd=0;
					int cnt=0;
					for(int k=0;k<n;k++){
						if(k==j||k==i) continue;
						std :: vector<int> q=ans;
						std :: swap(q[i],q[k]);
						int ct=count(q)-nows;
						if(ct==2){
							flg=jd=1,ans=q,nows+=2;
							tru[i]=tru[k]=1;
							fls[i]=fls[k]=0;
							break;
						}
						else if(ct==-2){
							flg=0,jd=1;
							tru[i]=tru[k]=1;
							fls[i]=fls[k]=0;
							break;
						}
						else if(ct==0){
							flg=jd=1;
							tru[i]=tru[k]=0;
							fls[i]=fls[j]=1;
							break;
						}
						else if(ct==-1&&(fls[k]||tru[k])){
							if(fls[k]) flg=0,tru[i]=1,fls[i]=0;
							if(tru[k]) flg=1,tru[i]=0,fls[i]=1;
							break;
						}
						else if(ct==1){
							cnt++;
							if(cnt>2) break;
						}
					}		
					if(!jd){
						flg=(cnt==2);
						if(flg) tru[i]=0,fls[i]=1;
					}
				}
				if(!flg){
					tru[i]=1;
					fls[i]=0;
					fls[j]=1;
					tru[j]=0;
				}
				else{
					tru[j]=1;
					fls[j]=0;
				}
			}
			else if(ct==-1){
				bool flg=0;
				if(tru[j]){
					flg=1;
					tru[i]=0,fls[i]=1;
				}
				else if(fls[j]){
					flg=0;
				}
				else if(i>0){
					std :: vector<int> q=ans;
					std :: swap(q[i-1],q[i]);
					if(count(q)-nows==-2){
						tru[i]=1,fls[i]=0;
						tru[j]=0,fls[j]=1;
						flg=0;
					}
					else{
						tru[j]=1,fls[j]=0;
						tru[i]=0,fls[i]=1;
						flg=1;
					}
				}
				else{
					bool jd=0;
					int cnt=0;
					for(int k=0;k<n;k++){
						if(k==j||k==i) continue;
						std :: vector<int> q=ans;
						std :: swap(q[i],q[k]);
						int ct=count(q)-nows;
						if(ct==2){
							flg=jd=1,ans=q,nows+=2;
							tru[i]=tru[k]=1;
							fls[i]=fls[k]=0;
							break;
						}
						else if(ct==-2){
							flg=0,jd=1;
							tru[i]=tru[k]=1;
							fls[i]=fls[k]=0;
							break;
						}
						else if(ct==0){
							flg=jd=1;
							tru[i]=tru[k]=0;
							fls[i]=fls[j]=1;
							break;
						}
						else if(ct==-1&&(fls[k]||tru[k])){
							if(fls[k]) flg=0,tru[i]=1,fls[i]=0;
							if(tru[k]) flg=1,tru[i]=0,fls[i]=1;
							break;
						}
						else if(ct==1){
							cnt++;
							if(cnt>2) break;
						}
					}		
					if(!jd){
						flg=(cnt==2);
						if(flg) tru[i]=0,fls[i]=1;
					}
				}
				if(!flg){
					tru[i]=1;
					fls[i]=0;
					fls[j]=1;
					tru[j]=0;
				}
				else{
					tru[j]=1;
					fls[j]=0;
				}
			}
			else{
				fls[i]=fls[j]=1;
				tru[i]=tru[j]=0;
			}
		}
	}
	return ans;
}

int main(){

	return 0;
}